package top.itmeans.yes.portal.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.itmeans.yes.common.api.CommonResult;
import top.itmeans.yes.portal.domain.OrderReturnApplyParam;
import top.itmeans.yes.portal.service.PortalOrderReturnApplyService;

/**
 * 退货申请管理Controller
 * @author Yiming.Cao
 */
@RestController
@Api(tags = "PortalOrderReturnApplyController")
@RequestMapping("/returnApply")
public class PortalOrderReturnApplyController {
    @Autowired
    private PortalOrderReturnApplyService returnApplyService;

    @ApiOperation("申请退货")
    @PostMapping
    public CommonResult create(@RequestBody OrderReturnApplyParam returnApply) {
        int count = returnApplyService.create(returnApply);
        if (count > 0) {
            return CommonResult.success(count);
        }
        return CommonResult.failed();
    }
}
